<div id="main-menu">
	<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
	  <div class="container-fluid">
	    <!-- Brand and toggle get grouped for better mobile display -->
	    <div class="navbar-header">
	      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
	        <span class="sr-only">Toggle navigation</span>
	        <span class="icon-bar">dddđ</span>
	        <span class="icon-bar">ffff</span>
	        <span class="icon-bar">ffffd</span>
	      </button>
	      <a class="navbar-brand" href="/pinterest/UserImageBoards/listImages">Pinterest</a>
	    </div>

	    <!-- Collect the nav links, forms, and other content for toggling -->
	    
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      
	      <ul class="nav navbar-nav">
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Category <span class="caret"></span></a>
	          <ul class="dropdown-menu" role="menu">
	          <?php
	          $categories=$this->requestAction('Images/listcategories');
	          //pr($categories);

	          foreach ($categories as $categorie) {
	          	//pr($categorie['Categorie']['categoriename']);
	          	echo '<li><a href="/pinterest/Images/findimagebycategories/'.$categorie['Categorie']['categoriename'].'">'.$categorie['Categorie']['categoriename'].'</a></li>';
	          
	         	} ?>
	            
	          </ul>
	        </li>
	        
			
			
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Board <span class="caret"></span></a>
	          <ul class="dropdown-menu" role="menu">
	            <li><a href="/pinterest/Boards/addBoard">Add new board</a></li>
	            <li><a href="/pinterest/Boards/viewInfoBoards">View boards</a></li>
	            <li><a href="/pinterest/Boards/listBoardToFollow">Follow board</a></li>
	            
	          </ul>
	        </li>
	        
			
			
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Image <span class="caret"></span></a>
	          <ul class="dropdown-menu" role="menu">
	            
	            <li><a href="/pinterest/Boards/addImageIntoBoard">Upload new image</a></li>
	            <li><a href="/pinterest/UserImageBoards/listImagesToPin">Pin image</a></li>
	            <li class="divider"></li>
	            <li><a href="/pinterest/Images/findimagebyname">Find image</a></li>
	          </ul>
	        </li>

	      </ul>
	    <?php 
	    	$friend=$this->requestAction('Users/listaddfriend');
	    	$name=$this->requestAction('Users/view');
	    	$count=$this->requestAction('Users/count');
	    	
	    	$newMessages = $this->requestAction('UserMessages/newMessages');

	    ?> 
	      <ul class="nav navbar-nav navbar-right">

	      	<li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Messages <span class="badge"><?php echo count($newMessages); ?></span></a>
	          	<ul class="dropdown-menu" role="menu">
	          	<?php
	          		if(count($newMessages) != 0){
	          			foreach($newMessages as $message){
	          	?>
		          
		            <li><a href="/pinterest/UserMessages/viewNewMessage/<?php echo $message['UserMessage']['from_user_id']; ?>">From <?php echo $message['Profile']['name']; ?></a></li>
		            
				<?php
						}
					}
				?>
					<li class="divider"></li>
		            <li><a href="/pinterest/UserMessages/listUser">Send message</a></li>
		         </ul>
	        </li>      	 
	        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Friends <span class="badge"><?php  echo $count;?></span></a>
            <ul class="dropdown-menu" role="menu">
            <?php  if ($friend)
            foreach($friend as $fr){?>

            <li>
              <?php
	          	echo $this->Html->image($fr['Profile']['avatar'],array(
                                        'alt'=>'CakePHP',
                                        'class'=>'img-circle',
                                        'width'=>'30',
                                        'height'=>'30'));
	          	echo ' '.$fr['Profile']['name'];
	          ?>
            

            <a href="/pinterest/FriendUsers/friend/<?php echo $fr['User']['id'];echo '/';echo $name['User']['id'];?>">Xác nhận </a>
            </li>
            <li class="divider"></li>
            
            <?php }
                 else echo 'Không có ai';?>
            </ul>
            
            </li>   
            <li><a href="/pinterest/Users/view"><?php
	          	echo $this->Html->image($name['Profile']['avatar'],array(
                                        'alt'=>'CakePHP',
                                        'class'=>'img-circle',
                                        'width'=>'30',
                                        'height'=>'30'));
	          	echo ' '.$name['Profile']['name'];
	          ?></a></li>  	 
	        <li class="dropdown" style="margin-top: 10px;">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
	          
	         
	          <span class="glyphicon glyphicon-list"></span></a>
	          <ul class="dropdown-menu" role="menu">
                <li><a href="/pinterest/Users/updateprofile">Profile</a></li>
	            <li><a href="/pinterest/Users/changepassword">Đổi mật khẩu</a></li>
                <li><a href="/pinterest/Users/listfriend">Bạn bè</a></li>
	            <li class="divider"></li>
	            <li><a href="/pinterest/Users/logout">Đăng xuất</a></li>
	          </ul>
	        </li>
	      </ul>
	    </div><!-- /.navbar-collapse -->
	  </div><!-- /.container-fluid -->
	</nav>
</div>
<div id="top-empty">
</div>